package com.jeehentor.ai.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeehentor.ai.entity.AiPlatformConfig;
import org.apache.ibatis.annotations.Select;

import java.util.Optional;

public interface AiPlatformConfigMapper extends BaseMapper<AiPlatformConfig> {

    /**
     * 查询指定平台下已启用的配置（根据 platform 字段）
     */
    @Select("SELECT * FROM ai_platform_config WHERE platform = #{platform} AND is_active = 1 ORDER BY sort ASC LIMIT 1")
    Optional<AiPlatformConfig> selectByPlatformName(String platform);
}
